package y24.m4;

import java.util.Scanner;

interface StudentInterface{
    void setFee(double fee);//设置学费
    double getFee();//获取学费

}
interface TeacherInterface{
    void setPay(double pay);//设置教师工资
    double getPay();//获取教师工资
}

class Graduate implements StudentInterface,TeacherInterface{
    private String name;
    private byte sex;
    private short age;
    private double fee;
    private double pay;

    public Graduate(String name, byte sex, short age) {
        this.name = name;
        this.sex = sex;
        this.age = age;
    }

    @Override
    public void setFee(double fee) {
        this.fee = fee;
    }

    @Override
    public double getFee() {
        return this.fee;
    }

    @Override
    public void setPay(double pay) {
        this.pay = pay;
    }

    @Override
    public double getPay() {
        return this.pay;
    }
}


public class Test13 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入你的姓名：");
        String name = scanner.next();
        System.out.print("请选择你的性别<0-女  1-男>：");
        byte sex = scanner.nextByte();
        System.out.print("请输入你的年龄：");
        short age = scanner.nextShort();
        Graduate luoTianQi = new Graduate(name,sex,age);
        System.out.println("请输入你的学费");
        luoTianQi.setFee(scanner.nextInt());
        System.out.println("请输入你的年收入");
        luoTianQi.setPay(scanner.nextInt());
        double money = luoTianQi.getPay() - luoTianQi.getFee();
        double loan = 0;
        if (money < 2000){
            loan = 2000 - money;
            System.out.println("你需要贷款" + loan + "元");
        }else {
            System.out.println("你不需要贷款");
        }
    }
}
